import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '班组',
    align: "center",
    dataIndex: 'team'
  },
  {
    title: '名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '依据名称',
    align: "center",
    dataIndex: 'basisName'
  },
  {
    title: '依据编号',
    align: "center",
    dataIndex: 'basisNum'
  },
  {
    title: '限制范围',
    align: "center",
    dataIndex: 'scope'
  },
  {
    title: '说明',
    align: "center",
    dataIndex: 'remark'
  },
  {
    title: '依据附件',
    align: "center",
    dataIndex: 'basisAtta',
    slots: { customRender: 'fileSlot' },
  },
  {
    title: '类型',
    align: "center",
    dataIndex: 'type_dictText'
  },
  {
    title: '父级id',
    align: "center",
    dataIndex: 'pid',
    customRender:({text}) => {
       return render.renderCategoryTree(text,'');
   },
  },
  {
    title: '级次',
    align: "center",
    dataIndex: 'level_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "班组",
    field: 'team',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "名称",
    field: 'name',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "类型",
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
  {
    label: "父级id",
    field: 'pid',
    component: 'JCategorySelect',
    componentProps:{
      pcode: "",//back和事件未添加，暂时有问题
    },
    colProps: {span: 6},
  },
  {
    label: "级次",
    field: 'level',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '班组',
    field: 'team',
    component: 'Input',
  },
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '依据名称',
    field: 'basisName',
    component: 'Input',
  },
  {
    label: '依据编号',
    field: 'basisNum',
    component: 'Input',
  },
  {
    label: '限制范围',
    field: 'scope',
    component: 'Input',
  },
  {
    label: '说明',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '依据附件',
    field: 'basisAtta',
    component: 'JUpload',
    componentProps:{
     },
  },
  {
    label: '类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
  },
  {
    label: '父级id',
    field: 'pid',
    component: 'JCategorySelect',
    componentProps:{
      pcode: "", //TODO back和事件未添加，暂时有问题
    },
  },
  {
    label: '级次',
    field: 'level',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
